Fix a cornercase crash
authorMatthias Clasen <mclasen@redhat.com>
Fri, 29 May 2015 03:42:14 +0000 (23:42 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 29 May 2015 03:42:14 +0000 (23:42 -0400)
If gtk_text_layout_move_cursor_visually is called with a
count of 0, we were passing NULL to a free function that
can't handle it. Don't do that.

https://bugzilla.gnome.org/show_bug.cgi?id=750058

gtk/gtktextlayout.c

index 00dbefae04143aa2ec16ce16d6afb6405603e8a2..763ef3b7c8007ae318ec38dd4056894cc5bb6a9e 100644 (file)
@@ -3660,7 +3660,8 @@ gtk_text_layout_move_iter_visually (GtkTextLayout *layout,
         gtk_text_iter_backward_char (iter);
     }
 
-  gtk_text_layout_free_line_display (layout, display);
+  if (display)
+    gtk_text_layout_free_line_display (layout, display);
 
  done: